package com.cr.front.controller;

import com.cr.common.response.JsonResult;
import com.cr.front.pojo.dto.AuthenticationSaveParam;
import com.cr.front.pojo.vo.LongRentVO;
import com.cr.front.service.AuthenticationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("/v1")
public class AuthenticationController {
    @Autowired
    private AuthenticationService authenticationService;

    @PostMapping("cr_authentication")
    public JsonResult authentication(AuthenticationSaveParam authenticationSaveParam){
        authenticationService.insert(authenticationSaveParam);
        return JsonResult.success();
    }

    @GetMapping("select")
    public JsonResult select(){
        List<LongRentVO> list = authenticationService.select();
        return JsonResult.success(list);
    }
}
